package com.mumu.muPictureBackend;

import com.mumu.muPictureBackend.manager.CosManager;
import jakarta.annotation.Resource;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;

import java.net.URI;
import java.net.URISyntaxException;

@SpringBootTest
public class extractPath {
    @Resource
    CosManager cosManager;

    @Test
    public void extractPathTest() throws URISyntaxException {
        String url = "mumu-1385850220.cos.ap-nanjing.myqcloud.com/public/1987458163939049473/2025-11-09_5474588829585151.2025-10-30 181139.png";
        String prefix = "mumu-1385850220.cos.ap-nanjing.myqcloud.com/";

        String result;
        if (url.startsWith(prefix)) {
            result = url.substring(prefix.length());
        } else {
            result = url; // 如果前缀不存在，保留原字符串（或根据需求抛异常）
        }

        System.out.println("截取的网址是:" + result);
        // 输出: public/1987458163939049473/2025-11-09_5474588829585151.2025-10-30 181139.png

    }
}
